home *** CD-ROM | disk | FTP | other *** search
/ Die Speccy' 97 / Die Speccy' 97.iso / amiga_system / the_aminet / comm / misc / dcdd_v2_4.lha / DCDD.rexx < prev    next >
OS/2 REXX Batch file  |  1995-09-05  |  26KB  |  962 lines

  1.  
  2. /*
  3.   DCDD.rexx                                                      950905.1815
  4.  
  5.   changes since version 2.3
  6.  
  7.   941203 - added SPEAKER action using SHIFT F7 to toggle it on/off
  8.   950510 - testing delay before starting arexx script
  9.   950708 - added 4800 to connect WAIT string
  10.   950725 - changed PNET NewBillDay from 06 to 01 and NewBillAdj to 'NONE'
  11.   950731 - expanded display of hours used to 3 digits
  12.   950812 - added Arexx script for auto DL of Internet news group messages
  13.   
  14.  
  15.  
  16.                  DIRECT_CONNECT_DEMON DIALER  -  Version 2.4 
  17.  
  18.  
  19.   Use with Arexx Version 1.1 or better, BaudBandit 1.5 or better.
  20.   
  21.   Jerry Smith - Fresno, CA.             Contact BBS: F.A.A.X. (209) 226-7162
  22.  
  23.                   Internet address: CyberSmith@primenet.com
  24.  
  25.               Not copyrighted, fully in the public domain.
  26.       Various bits and pieces lifted from other PD ARexx programs.
  27.  
  28.   I would like to give special thanks to the following people:
  29.  
  30.     Dave Mullenix for his GREAT series of ARexx programs for dialing PC 
  31.     Pursuit. (Many of who's ideas are incorporated here)
  32.  
  33.     Darcy McConnell for the use of his BBS for tests, tests, tests, etc....
  34.  
  35.     Richard Stockton for his help with Arexx and BaudBandit.
  36.  
  37.     My Wife and Best Friend (Diane) for her help, warmth and understanding.
  38.  
  39. */
  40.  
  41. OPTIONS RESULTS
  42.  
  43. address BAUD 
  44.  
  45. parse arg filename
  46.  
  47. TRUE = (1=1)
  48. FALSE = ~ TRUE
  49. EXIT_TIMER = 0
  50. SPACER = ' '
  51.  
  52. if filename = '' then
  53.   DCDDPhone="DCDD"
  54. else
  55.   DCDDPhone=filename
  56.  
  57.  
  58. /* SHIFT F10 will stop this script before the next BBS is dialed
  59.              or break you out of a "stuck BBS"                    */
  60.  
  61. FKEY 'S10 \Mzap.continue.rexx' 
  62.  
  63. /* SHIFT F9 will keep any AUTO.rexx from doing an AUTO logout so 
  64.             that other work can be done before you logoff a BBS.  */
  65.  
  66. FKEY 'S9 \Msit_stay.rexx' 
  67.  
  68. /* SHIFT F8 will toggle modem speaker ON/OFF. Selected mode will
  69.             be in effect for NEXT dialing attempt                 */
  70.  
  71. FKEY 'S8 \Mspeaker.rexx' 
  72.  
  73. /*  GENERAL BAUDBANDIT SETTINGS BELOW                             */
  74.  
  75. mask on     /* turns on mask */
  76.  
  77. /*             mask off */
  78.  
  79. /*             ansi on */ 
  80.  
  81. /*             ansi off */ 
  82.  
  83. set F       /* blanks screen w/form feed                            */  
  84.  
  85. set 8N1     /* set modem to 8N1                                     */  
  86.  
  87. set A       /* set default to Z modem (auto DL)                     */
  88.  
  89. Auto OFF    /* turn Auto_PhoneBook OFF                              */
  90.  
  91. Popup OFF   /* You MUST have this in your default config or else have the
  92.                Phone Book screen getting in you way. (see DCDD.doc) */
  93.  
  94. screen off  /* allows CON screen to come to the front */
  95.  
  96.  
  97. Data 'RAM:-DL'  /* set up default download area for downloaded files */
  98.  
  99.  
  100.                     /* * * * * * * * * * * * * * * * * * * * 
  101.                       * * *  Open a full sized window * * *
  102.                      * * * * * * * * * * * * * * * * * * * */
  103.  
  104.  
  105. windev = "CON:1/11/640/189/ Direct Connect Demon Dialer . . . . . . . . . . . . phonebook "DCDDPhone
  106.  
  107. if ~open('wind',windev) then exit      /* Window for all activity */
  108.  
  109. NoError = 0
  110. NoTimeout = 0
  111.  
  112. maxnumbers = 80  /* maximum number of entries in phonebook */
  113.  
  114. call J_Date /* creates JDATE for testing against julian date computed 
  115.                from YYYYMMDD in the phonebook for display on 80 BBS
  116.                selection screen */
  117.   
  118. call ReadPhoneBk
  119.  
  120. call GetTotTime
  121.  
  122. temp= 'Time Codes used above:  . 30 - 60 = 90 x 365 *'
  123. call wsaych(temp)
  124. call wsay('           Select BBS(s):')
  125.  
  126. BBSelections = readln('wind')
  127.  
  128. screen on  /* turns BaudBandit screen on */
  129. send '\U'  /* brings BaudBandit screen to the front - here and now! 
  130.               The one in the main loop will bring the screen to the front
  131.               when a BBS is connected. */
  132.  
  133.  
  134. /* below allows you to enter an "A" as the first character in your BBS
  135.    selections to activate the AUTO function in Do_WHOEVER.rexx scripts. 
  136.  
  137.    Please note that you can not mix AUTO and MANUAL selections in the same 
  138.    session. I may change this if enough people ask for it. 
  139.  
  140.    See Do_FAAX.rexx for an example..... */
  141.  
  142. parse var BBSelections AUTO 2 .     
  143.  
  144. if upper(AUTO) = 'A' then do
  145.    address command 'makedir RAM:AUTO'
  146.    msg '********** -------------------- **********'
  147.    msg '********** AUTO PROCESS STARTED **********'
  148.    msg '********** -------------------- **********'
  149.    call delay(100)
  150.    end
  151.  
  152. /* below allows BBS number(s) separated by ,./;:\|+-*# or space(s) */
  153. y=translate(BBSelections,' ',',Aa./;:\|=+_*#') 
  154.  
  155. bbs2call=0
  156. do i = 1 to bbsnums
  157.   parse var y first y
  158.   bbs2call=bbs2call+1
  159.   bbs.i = first
  160.   if first == '' then leave  /* breaks out of DO FOREVER loop */
  161. end
  162.  
  163. bbs2call=bbs2call-1
  164. msg ' '
  165. msg bbs2call 'Selected BBSes to be Called'
  166. msg_x_flag = ' '
  167.  
  168. do z=1 to bbs2call
  169.   t=bbs.z
  170.   msg_x = ' ' /* two tests below done only on selected BBSes */
  171.   do    /* below tests for AREXX SCRIPT in BBS for AUTO process */
  172.      if UPPER(AUTO) = 'A' then do 
  173.         if bbs.t.script = ' ' then do
  174.            msg_x = '****** MISSING AREXX SCRIPT ******'
  175.            msg_x_flag = 'bad'
  176.         end
  177.      end
  178.   end 
  179.   do    /* below tests for CAPTURE TITLE in BBS for MANY processes */
  180.      parse var bbs.t.captitle CT_TEST . 
  181.      if CT_TEST = ' ' then do
  182.         msg_x = '****** MISSING CAPTURE TITLE ******'
  183.         msg_x_flag = 'bad'
  184.      end
  185.   end 
  186.  
  187.   msg z':' bbs.t.name '  ' msg_x
  188. end 
  189.  
  190. if msg_x_flag = 'bad' then do
  191.    bbs2call = 0
  192.    msg ' '
  193.    msg ' '
  194.    msg '****** PHONEBOOK ERROR(S) - SEE LIST ABOVE ******'
  195.    msg ' '
  196.    msg '10'
  197.    call delay(50)
  198.    msg '  9'
  199.    call delay(50)
  200.    msg '    8'
  201.    call delay(50)
  202.    msg '       7'
  203.    call delay(50)
  204.    msg '           6'
  205.    call delay(50)
  206.    msg '                5'
  207.    call delay(50)
  208.    msg '                       4'
  209.    call delay(50)
  210.    msg '                                3'
  211.    call delay(50)
  212.    msg '                                           2'
  213.    call delay(50)
  214.    msg '                                                          1'
  215.    call delay(50)
  216. end 
  217.  
  218.  
  219. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  220.  *                                                               *
  221.  *                          Main Loop                            *
  222.  *                                                               *
  223.  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  224.  
  225.  
  226. listindex=1 ;
  227. do while bbs2call ~= 0                                        
  228.  
  229.   indx = bbs.listindex
  230.  
  231.   call CONTINUE_TEST
  232.   
  233.   msg ''
  234.   if upper(AUTO) = 'A' then 
  235.      msg 'AUTO >> Dialing:' bbs.indx.name  
  236.   else
  237.      msg 'Dialing:' bbs.indx.name 
  238.  
  239.   bbsconnect = false
  240.   nresult = ' '
  241.  
  242.   call at_codes  /* send AT codes to modem for selected BBS. This is VERY
  243.                     useful when using a SupraFAXmodem V32.bis at 14.4 */ 
  244.  
  245.      Data 'RAM:-DL'  /* set up default download area for downloaded files */
  246.  
  247.      if CallBBS(bbs.indx.phone) = NoTimeout then do      
  248.        if pos('CARRIER',nresult) = 1 then do
  249.                  
  250.          /* next line resets elapsed timer */
  251.  
  252.          call time(R)
  253.    
  254.          timea=translate(time(n),' ',':')              
  255.          parse value timea with timeHH timeMM timeSS .  
  256.          timeHHMM=timeHH||timeMM 
  257.  
  258.          call GetToday
  259.  
  260.          beep 
  261.  
  262.   send '\u' /* (pull screen to front when bbs connected) 
  263.                You may or may not want to use this here. */
  264.  
  265.   parse var bbs.indx.captitle CT PW1 PW2 LD TM MN SPD .
  266.  
  267. /* Capt "RAM:-dl below puts all Capture Logs in to this dir */
  268.  
  269.           if CT ~= '' then                
  270.             Capt 'RAM:-dl/'CT'.'dateYYMMDD'.'timeHHMM'.1'    
  271.  
  272.  /* above gives you files like OLD_DOC.930719.1718.1 - Had to add time so
  273.     that files opened up on RAM:-dl would not duplicate files in DH1:-dl 
  274.     when they are transfered after logging out of a BBS. Really do need to
  275.     download into RAM when doing V32.bis 14.4 with a 68000 native CPU. */
  276.  
  277.           if bbs.indx.script ~= '' then do                    
  278.    call delay(10)
  279.             parse var bbs.indx.script title Xargs
  280.     /*        msg 'Starting Arexx Script: ' title  */
  281.  
  282.             if PW1 = ' ' then PW1 = 'NO_PW_1'
  283.             if PW2 = ' ' then PW2 = 'NO_PW_2'
  284.  
  285.             if Xargs = ' ' then Xargs = ' NO_Xargs'
  286.             OUTargs = title||"("PW1||spacer||PW2||Xargs||")"
  287.  
  288.             interpret 'call' OUTargs
  289.           end                                                 
  290.  
  291.           call DoPairs
  292.  
  293.           call wait4disconnect
  294.  
  295.           Capture OFF  
  296.           
  297. /* items below copy ALL data in RAM:-dl to DH1:-dl 
  298.          and then clears RAM:-dl for the next BBS called.
  299.  
  300.    At the end of a days BBSing I create a file called DH1:-dl-YYMMDD
  301.       and copy the contents of DH1:-dl into it and then clear DH1:-dl
  302.       for the next days activity. */
  303.  
  304. /* BE SURE DH1: has room for the files you DL!!!!!!!!!!!!!!!!! */
  305.  
  306.           address command 'copy RAM:-dl/#? DH1:-dl'
  307.           address command 'delete RAM:-dl/#?'
  308.  
  309.           call removebbs /* remove bbs from selection group */
  310.  
  311.         end
  312.  
  313.         send '\d'   /* drop DTR */
  314.         send '\ah'  /* hangs up modem */
  315.  
  316.         call selectnextbbs /* select next bbs from selection group */
  317.  
  318.         end                                                       
  319.  
  320.   call CONTINUE_TEST  /* test for ram:continue as flag to continue or quit*/
  321.  
  322.   if listindex > bbs2call then 
  323.      listindex = 1
  324.  
  325. end
  326.  
  327. /* next two lines force DCDD.rexx to quit */
  328.  
  329. address command 'delete RAM:continue'    
  330. call CONTINUE_TEST    
  331.  
  332. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  333.  *                                                             *
  334.  *                   Functions / Subroutines                   *
  335.  *                                                             *
  336.  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  337.  
  338.  
  339. Continue_Test:
  340.  
  341. /* tests for RAM:continue as flag to continue or quit */
  342.  
  343. if exists('ram:continue')=0 then do
  344.    call delay(50)
  345.    msg ' '
  346.    msg ' '        
  347.    msg '**************************************************'
  348.    msg '*****                                       ******'
  349.    msg '***** EXITING * DIRECT CONNECT DEMON DIALER ******'
  350.    msg '*****                                       ******'
  351.    msg '**************************************************'
  352.    capture OFF  
  353.    call close('wind')
  354.    send '\d'   /* drop DTR */
  355.    send '\ah'  /* hangs up modem */
  356.    send '\aq'  /* closes BaudBandit  */
  357.    exit        /* exits Arexx        */
  358.    end
  359. else do
  360.    call delay(10)
  361.    beep
  362.    call delay(10)
  363.    beep
  364.    end
  365. return
  366.  
  367.  
  368. AT_codes:
  369.  
  370. /* sends special AT codes for currently selected BBS to modem */
  371.  
  372.    send 'AT&F2'  /* resets modem to factory settings          */
  373.    send '\w\r' 
  374.    send 'AT&F2'  /* resets modem to factory settings 2nd time */
  375.    send '\w\r'   /* don't know why it needs it but it do!     */ 
  376.  
  377. /* W1 below is necessary to set the CARRIER option so that the
  378.       baud rate at connect is captured. 
  379.    M = speaker off.  */
  380.  
  381.   if bbs.indx.atcodes ~= '' then  
  382.      msg 'AT codes sent to modem - ' bbs.indx.atcodes
  383.   if exists('ram:speaker')=0 then /* file not there */
  384.      send 'AT M W1 'bbs.indx.atcodes  
  385.   if exists('ram:speaker')~=0 then /* file exists */
  386.      send 'AT W1 'bbs.indx.atcodes 
  387.   send '\w\r'
  388. return
  389.  
  390.  
  391. Wsay:
  392.  
  393. /* put string to window with EOL */
  394.  
  395.   parse arg strx   
  396.   call writeln('wind',strx)
  397. return
  398.  
  399.          
  400. WsayCH:
  401.   
  402. /* put string to window without EOL */
  403.  
  404.   parse arg strx   
  405.   call writech('wind',strx)
  406. return
  407.  
  408.          
  409. DoPairs:
  410.  
  411. /* Have BaudBandit execute script pairs just like in Phonebook */
  412.  
  413. /* Some BBS software needs an ESCAPE key (or two) to load and this can be
  414.    taken care of using a Script Pair that starts like:
  415.  
  416.    {Escape twice=\w\x1B\w\x1B\w\r}{....then your remaining stuff....
  417.  
  418. */
  419.  
  420.  if bbs.indx.pair ~= '' then do /* Do optional pairs after connect */
  421.     address BAUD 
  422.     pairs bbs.indx.pair
  423.  end 
  424.  
  425. return
  426.  
  427.  
  428. wait4disconnect:
  429.  
  430. if bbs.indx.script = '' then do                    
  431.   msg ''
  432.   msg '+--------------------------------------+'
  433.   msg '  WAITING FOR 'bbs.indx.name' DISCONNECT '
  434.   msg '+--------------------------------------+'
  435. end
  436.  
  437.   call delay(150) 
  438.  
  439.   do forever
  440.      ADDRESS BAUD
  441.      dcd
  442.  
  443. /*   note: RTEST holds RC value as RC resets after every Arexx command
  444.            is executed. */
  445.  
  446.      RTEST = RC
  447.      if RTEST = 0 then do
  448.         msg '... Dropped Carrier ...'
  449.         leave  /* breaks out of DO FOREVER loop */
  450.      end
  451.      call delay(250)  /* 5 second delay for FOREVER loop */
  452.  
  453. /* below uses shift F10 to get out of a "STUCK BBS". 
  454.    this routine also used for Arexx Script failed WAIT LOOP exiting.
  455.    Please note that this does NOT end the session just current BBS. */
  456.  
  457.       if exists('ram:continue')=0 then do
  458.          msg '****** FORCED BBS LOGOFF BY USER ******'
  459.          address command 'makedir ram:continue'
  460.          call delay(50) 
  461.          leave    /* breaks out of DO FOREVER loop */
  462.       end
  463.  
  464. /* NOTE: process below replaced by NESTED DO FOREVER/WAIT LOOPS 
  465.          see Do_FAAX.rexx for an example... */
  466.  
  467. /* below uses RAM:exit_flag to get out of a "STUCK BBS" when 
  468.    you are using Arexx scripts for Auto late nite sessions
  469.    and want to be sure of exiting a BBS if they have changed
  470.    things and your script gets "HUNG UP". The EXIT_TIMER will
  471.    be reset to zero if RAM:exit_flag is absent.  */
  472.  
  473.  
  474.  
  475.      if exists('ram:exit_flag')=0 then do 
  476.         exit_timer = 0
  477.         end
  478.      else do  
  479.         exit_timer = exit_timer + 5
  480.         if exit_timer > 300 then do 
  481.            msg '****** FORCED LOGOFF BY EXIT_TIMER ******'
  482.            call delay(50) 
  483.            address command 'delete ram:EXIT_TIMER'
  484.            leave     /* breaks out of DO FOREVER loop */
  485.            end
  486.         end
  487.  
  488.   end
  489.  
  490. /*
  491.     below is old OLD way of holding till logged off BBS.
  492.     it had a "BIG" problem with matching text during DL's.
  493.  
  494.     wait 'NO CARRIER'
  495. */
  496.  
  497. /* Get connection elapsed time from Arexx timer */
  498.  
  499.   timeE=(time(e)) 
  500.   chours = timeE % 3600
  501.   choursrem = timeE // 3600
  502.   cmins = choursrem % 60
  503.   csecsx = choursrem // 60
  504.   csecs = csecsx % 1
  505.   cTOTAL = right(chours,3,'0')':'right(cmins,2,'0')':'right(csecs,2,'0')
  506.  
  507.   msg 'Updating Total Time'
  508.  
  509. /* 
  510.    DCDDdiscos file contains information about the BBS Session that just
  511.    ended along with all the previous sessions you want to keep. 
  512.  
  513.    the dateYYMMDD timeHHMM phone connect-time info can be compared to
  514.    your phone bill to make sure you get all the service you pay for.
  515.    this file will grow and grow unless you prune it back.    
  516. */
  517.  
  518.   discotitle='DCDDdiscos'   
  519.   if open('discos',discotitle,'Append') = 0 then  /* append if exists */
  520.      call open('discos',discotitle,'Write')       /* else create file */
  521.  
  522.   temp = dateYYMMDD timeHHMM bbs.indx.phone cTOTAL CT SPEED bbs.indx.name  
  523.   call writeln('discos',temp)
  524.   call close('discos')
  525.  
  526. /* 
  527.    History file added so that this file will (when sorted) give you a
  528.    complete log of sessions on a BBS by BBS basis. this file will 
  529.    grow and grow unless you prune it back.    
  530. */
  531.  
  532.   htitle='DCDDhistory'   
  533.   if open('hist',htitle,'Append') = 0 then  /* append if exists */
  534.      call open('hist',htitle,'Write')       /* else create file */
  535.  
  536.   htemp = CT dateYYMMDD timeHHMM cTOTAL SPEED bbs.indx.name 
  537.   call writeln('hist',htemp)
  538.   call close('hist')
  539.    
  540. /* 
  541.    below reads in the Bandit.'DCDDPhone' file and writes it out to 
  542.    ram:Bandit.'DCDDPhone'. During this process the bbs.j.captitle record
  543.    is updated for the BBS just visited for BBS activity tracking. This
  544.    will be used at the next session to display information on the BBS
  545.    selection screen so that you know how long ago you visited that BBS.
  546.  
  547.    this process also updates the other Bandit.'DCDDPhone' bbs.j.captitle
  548.    records and reformats them as necessary.
  549. */
  550.  
  551.   call open('in1A','Bandit.'DCDDPhone,'r')
  552.   call open('out1A','ram:Bandit.'DCDDPhone,'W')
  553.  
  554.   call J_DATE  /* used to get JDATE at logoff point in BBS session */
  555.  
  556. /* Read BBS PhoneBook records */
  557.   do until EOF('in1A')
  558.     inline1A=readln('in1A')
  559.     if ~ EOF('in1A') then do
  560.       parse var inline1A DASHES 6 .
  561.       if DASHES = '-----' then
  562.         line_cnt = 0
  563.       line_cnt = line_cnt + 1
  564.       if line_cnt = 6 then do
  565.         parse var inline1A CTN PW1N PW2N LDN TMN MNN SPDN .
  566.         if PW1N   = ' ' then PW1N   = 'NO_PW_1'
  567.         if PW2N   = ' ' then PW2N   = 'NO_PW_2'
  568.         if LDN    = ' ' then LDN    = 19780101   /* 19780101 was the first */
  569.         if LDN    = 0   then LDN    = 19780101  /* day of the AMIGA age.  */
  570.         if TMN    = ' ' then TMN    = 0        /* see Arexx "date" docs  */       
  571.         if MNN    = ' ' then MNN    = 0        
  572.         if SPDN   = ' ' then SPDN   = 0
  573.         if CTN = CT then do 
  574.           inline1A = CTN PW1N PW2N dateYYYYMMDD timeHHMM cTOTAL SPEED 
  575.           end
  576.         else do
  577.           inline1A = CTN PW1N PW2N LDN TMN MNN SPDN 
  578.           end
  579.       end /* end for (if line_cnt = 6) */  
  580.       call writeln('out1A', inline1A)
  581.     end /* end for (if ~ EOF) */
  582.   end /* end for (do until EOF) */  
  583.   call close('in1A')
  584.   call close('out1A')
  585.  
  586. /* below copies temporary file from ram back over Bandit.'DCDDPhone' file
  587.    and then deletes it in ram. */
  588.  
  589.   address command 'copy ram:Bandit.#? dh0:DemonDialer'
  590.   address command 'delete ram:Bandit.#?'
  591.  
  592.   call GetTimeTitle
  593.  
  594.   if open('TotTime',timetitle,'R')=0 then do /* Total hours, mins, secs */
  595.      thours = 0
  596.      tmins = 0                     /* If file doesn't exist, set to zero */
  597.      tsecs = 0
  598.      end
  599.   else do
  600.      thours=readln('TotTime')      /* If file does exist, read them */
  601.      tmins=readln('TotTime')
  602.      tsecs=readln('TotTime')
  603.      call close('TotTime')
  604.      end
  605.  
  606.   msg 'Monthly total:' right(thours,3,'0')':'right(tmins,2,'0')':'right(tsecs,2,'0')
  607.   msg '    This call:' cTOTAL
  608.   nhours = chours+thours
  609.  
  610.   if csecs > 0 then do  /* the Damn phone company rounds  */ 
  611.      cmins = cmins + 1  /* any seconds into a full minute */
  612.      csecs = 0        
  613.   end
  614.     
  615.   nmins = cmins+tmins
  616.   nsecs = csecs+tsecs
  617.  
  618.   nmins=nmins+nsecs%60 ; nsecs = nsecs//60
  619.   nhours=nhours+nmins%60 ; nmins = nmins//60
  620.  
  621.   call open('TotTime',timetitle,'W')
  622.   call writeln('TotTime', nhours)
  623.   call writeln('TotTime', nmins)
  624.   call writeln('TotTime', nsecs)
  625.   call close('TotTime')
  626.   msg '               --------'
  627.  
  628.   msg '    New Total:' right(nhours,3,'0')':'right(nmins,2,'0')':'right(nsecs,2,'0')' by 'TotalBy' for month/year: 'dateMMx'/'dateYYYYx
  629.   msg ' '
  630.  
  631. return
  632.  
  633.  
  634. removebbs:    
  635.  
  636. /* Done with that bbs, change ALL occurances to "called" in selection group */
  637.  
  638.   do j = 1 to bbs2call                  
  639.      if bbs.j = indx then do
  640.         bbs.j = 'called'
  641.      end                     
  642.   end                                   
  643.  
  644. return
  645.  
  646.  
  647. selectnextbbs:    
  648.  
  649. /* Select the next available BBS from selection group */
  650.  
  651.   yet2call = 0
  652.   wascalled = 0
  653.  
  654.   do k = 1 to bbs2call                         
  655.      if bbs.k = 'called' then do        
  656.         wascalled = wascalled + 1
  657.      end                                
  658.      else do                     
  659.         yet2call = yet2call + 1
  660.      end                         
  661.   end                                          
  662.  
  663.   if yet2call = 0 then do              
  664.      bbs2call = 0  
  665.      end                                  
  666.   else do                       
  667.  
  668.      loopcount = 0 
  669.  
  670.         do forever                           
  671.  
  672.         listindex=listindex + 1
  673.  
  674.         if listindex > bbs2call then        
  675.            listindex = 1
  676.            loopcount = loopcount + 1
  677.  
  678.         if bbs.listindex ~= 'called' then
  679.            leave   /* breaks out of DO FOREVER loop */
  680.  
  681.  
  682.         if loopcount > 2 then do  
  683.            msg '****** loopcount > 2 ******'
  684.            bbs2call = 0
  685.            leave   /* breaks out of DO FOREVER loop */
  686.  
  687.         end                       
  688.  
  689.      end                                          
  690.  
  691.      livecount = 0
  692.  
  693.      if yet2call ~= 0 or exists('ram:continue')=0 then do              
  694.         msg ' ' 
  695.         msg yet2call ' BBSes yet to be called'
  696.         do z=1 to bbs2call                            
  697.            t=bbs.z
  698.            if bbs.z ~= 'called' then do       
  699.               livecount = livecount + 1
  700.               msg livecount ':' bbs.t.name
  701.            end                                
  702.         end
  703.       end                                           
  704.   end                           
  705.  
  706. return
  707.  
  708.  
  709. CallBBS:
  710.  
  711. /* Dial Selected BBS */
  712.  
  713.   arg number
  714.   call delay(25)
  715.   timeout 120     /* wait continues if no connectstring within 2 minutes */
  716.   send 'ATDT'number'\r'
  717.   call shownotes
  718.   connectstring='CARRIER 14400,CARRIER 12000,CARRIER 9600,CARRIER 7200,CARRIER 4800,CARRIER 2400,BUSY,OK,NO CARRIER,NO DIALTONE'
  719.   wait connectstring
  720.   NRC = RC
  721.   NRESULT = RESULT
  722.   call delay(50)
  723.   parse value NRESULT with AAA SPEED .
  724.  
  725. /* SPEED above used to capture arbitated carrier connect speed */
  726.  
  727. return NRC
  728.  
  729.  
  730. shownotes:
  731.  
  732. /* Show BBS notes if present */
  733.  
  734.   if bbs.indx.notenum > 0 then do     
  735.     msg 'Notes for' bbs.indx.name':'
  736.     do notex = 1 to bbs.indx.notenum
  737.       msg bbs.indx.notes.notex
  738.     end
  739.   end
  740.  
  741.   else do
  742.      msg 'No notes for' bbs.indx.name
  743.   end
  744.   msg ' '
  745. return
  746.  
  747.  
  748. GetToday:
  749.  
  750.   dateYYYY=left(date(sorted),4)               
  751.   dateYYYYMM=left(date(sorted),6)               
  752.   dateMM=right(dateYYYYMM,2)              
  753.   dateYYMMDD=right(date(sorted),6)              
  754.   dateDD=right(dateYYMMDD,2)              
  755. return
  756.  
  757.  
  758. GetTotTime:
  759.  
  760. /* gets total time for the month */
  761.  
  762.   call GetTimeTitle
  763.  
  764.   if open('TotTime',timetitle,'R')=0 then do /* Total hours, mins, secs */
  765.     thours = 0
  766.     tmins = 0                     /* If file doesn't exist, set to zero */
  767.     tsecs = 0
  768.   end
  769.  
  770.   else do
  771.     thours=readln('TotTime')      /* If file does exist, read them */
  772.     tmins=readln('TotTime')
  773.     tsecs=readln('TotTime')
  774.     call close('TotTime')
  775.   end
  776. return
  777.  
  778.  
  779. GetTimeTitle:
  780.  
  781.   call GetToday
  782.  
  783. /*
  784.  
  785.    Internet access has been added to DCDD and this has forced me to keep
  786.    monthly time totals for different SERVICES. I am using PNET for my
  787.    Internet connection, LONGD for my long distance direct dialing, and
  788.    LOCAL for my local BBSes. The totals are controled the same as befor
  789.    by using NewBillDay and NewBillAdj. 
  790.  
  791.    If for instance NewBillDay = 8, and NewBillAdj = MINUS then the monthly
  792.    hours/minutes/seconds total will run from the 8th of one month till the
  793.    7th of the next month to match the way your phone company bills you.
  794.  
  795.    NewBillAdj is used to either put the first few days of this month into
  796.    last months totals (MINUS) or the last few days of this month into next
  797.    month (PLUS). (sort of crazy but it works!) 
  798.  
  799. */
  800.  
  801.  
  802.   parse var bbs.indx.service TotalBy .     
  803.  
  804. /* * * * * *  ************************************************  * * * * * */
  805. /* *********  BE SURE TO PUT THE DATA BELOW INTO DCDDtime.rexx  ********* */
  806. /* * * * * *  ************************************************  * * * * * */
  807.  
  808.   if TotalBy = ' ' then do
  809.      TotalBy = 'LONGD'
  810.      NewBillDay = 08
  811.      NewBillAdj = 'MINUS'
  812.   end 
  813.  
  814.   if TotalBy = 'LONGD' then do
  815.      NewBillDay = 08
  816.      NewBillAdj = 'MINUS'
  817.   end 
  818.  
  819. /*
  820.   if TotalBy = 'CRIS' then do
  821.      NewBillDay = 13
  822.      NewBillAdj = 'MINUS'
  823.   end 
  824. */
  825.  
  826.   if TotalBy = 'CRIS' then do
  827.      NewBillDay = 01
  828.      NewBillAdj = 'NONE'
  829.   end 
  830.  
  831.   if TotalBy = 'PNET' then do
  832.      NewBillDay = 01
  833.      NewBillAdj = 'NONE'
  834.   end 
  835.  
  836.   if TotalBy = 'LOCAL' then do
  837.      NewBillDay = 00
  838.      NewBillAdj = 'NONE'
  839.   end 
  840.  
  841. /* * * * * *  ************************************************  * * * * * */
  842. /* *********  BE SURE TO PUT THE DATA ABOVE INTO DCDDtime.rexx  ********* */
  843. /* * * * * *  ************************************************  * * * * * */
  844.  
  845.   dateMMx = dateMM
  846.   dateYYYYx = dateYYYY
  847.  
  848.   if NewBillAdj = "MINUS" then do
  849.      if dateDD < NewBillDay then do
  850.         if dateMM = 01 then do
  851.            dateMMx = 12
  852.            dateYYYYx = dateYYYY - 1
  853.            end
  854.         else do
  855.            dateMMx = dateMM - 1
  856.            if dateMMx < 10 then
  857.               dateMMx = 0||dateMMx
  858.         end
  859.      end
  860.   end
  861.  
  862.   if NewBillAdj = "PLUS" then do
  863.      if dateDD ~ < NewBillDay then do
  864.         if dateMM = 12 then do
  865.            dateMMx = 01
  866.            dateYYYYx = dateYYYY + 1
  867.            end
  868.         else do
  869.            dateMMx = dateMM + 1
  870.            if dateMMx < 10 then
  871.               dateMMx = 0||dateMMx
  872.         end
  873.      end
  874.   end
  875.   timetitle='DCDDtime_'totalby||'_'||dateYYYYx||dateMMx
  876.   dateYYYYMMDDx = dateYYYYx||dateMMx||dateDD 
  877.  
  878.   if NewBillAdj = "NONE" then do
  879.      timetitle='DCDDtime_'totalby||'_'||dateYYYYMM
  880.      dateYYYYMMDDx = dateYYYY||dateMM||dateDD 
  881.      end
  882.   
  883.   return
  884.  
  885.  
  886. J_DATE:
  887.  
  888. dateYYYYMMDD = left(date(sorted),8)
  889. JDATE = date('i',dateYYYYMMDD,'s')
  890.  
  891. return
  892.  
  893. ReadPhoneBk:
  894.  
  895. /* Read Phone Book into Arexx array */
  896.  
  897. call open('PhoDir','Bandit.'DCDDPhone,'r')
  898.  
  899. bbsnums = 0                            /* Read BBS records */
  900. inline1=readln('PhoDir')
  901. do j=1 to maxnumbers until eof('PhoDir')
  902.   bbsnums = bbsnums + 1
  903.   bbs.j.name=strip(readln('PhoDir'))
  904.   bbs.j.phone=strip(readln('PhoDir'))
  905.   bbs.j.service=strip(readln('PhoDir'))
  906.   bbs.j.atcodes=strip(readln('PhoDir'))
  907.   bbs.j.captitle=strip(readln('PhoDir'))
  908.   bbs.j.script=strip(readln('PhoDir'))
  909.   bbs.j.pair=strip(readln('PhoDir'))
  910.  
  911.   /* Read optional notes */
  912.   notex=0 ; inline1=''
  913.   do until inline1 = '-----' | EOF('PhoDir')
  914.     inline1=readln('PhoDir')
  915.     if inline1 ~= '-----' then do
  916.       notex = notex + 1
  917.       bbs.j.notes.notex = inline1
  918.     end
  919.   end
  920.   bbs.j.notenum = notex
  921.  
  922.   /* Print BBS name */
  923.  
  924.   parse var bbs.j.captitle CTN PW1N PW2N LDN TMN MNN SPDN .
  925.  
  926. /* JDATE (below) is from initilization point at start of this session */
  927.  
  928.   if LDN    = ' ' then LDN    = 19780101   /*  19780101 was the first  */
  929.   if LDN    = 0   then LDN    = 19780101  /*  day of the AMIGA era.   */
  930.                                          /*  see Arexx "date" docs   */
  931.  
  932.   JDATEN = date('i',LDN,'s')
  933.  
  934.   JDIFF = JDATE - JDATEN
  935.   JX = '.'
  936.   if jdiff > 030 then JX = '-'
  937.   if jdiff > 060 then JX = '='
  938.   if jdiff > 090 then JX = 'x'
  939.   if jdiff > 365 then JX = '*'
  940.  
  941.   if j//4 ~= 0 then do /* allows four across on CON window */
  942.  
  943. /*
  944.    I use bbs.j.captitle instead of bbs.j.name below because all my files 
  945.    use the same name as my discos and capture files and I only have to 
  946.    remember one name. The FULL name is used when you connect to a BBS
  947. */
  948.  
  949.  
  950.     call wsaych(right(j,2,' ') JX left(CTN,14,' '))
  951.     end
  952.   else
  953.     call wsay(right(j,3,' ') JX left(CTN,14,' '))
  954. end  
  955. call close('PhoDir')
  956.  
  957. bbsnums=bbsnums-1
  958. if bbsnums//2 = 0 then 
  959.   call wsay('')
  960. return
  961.  
  962.